<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>作业2:水平居中、垂直居中</title>
    <style>
        .f {
            width: 500px;
            height: 500px;
            background-color: #5f9ea0;

            margin: auto;
            display: flex;
            /* 垂直居中 */
            justify-content: center;
            /* 水平居中 */
            align-items: center;
        }

        .f .s {
            width: 200px;
            height: 200px;
            background-color: #add8e6;

            display: flex;
            /* 垂直居中 */
            justify-content: center;
            /* 水平居中 */
            align-items: center;
        }
    </style>
</head>

<body>
    <div class="f">
        <div class="s"></div>
    </div>
</body>

</html>